package org.linlinjava.litemall.db.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.linlinjava.litemall.db.dao.LitemallGiftCardMapper;
import org.linlinjava.litemall.db.domain.*;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

@Service
public class LitemallGiftCardService extends MPJBaseServiceImpl<LitemallGiftCardMapper,LitemallGiftCard> {
    @Resource
    private LitemallGiftCardMapper litemallGiftCardMapper;



    public LitemallGiftCard findById(Integer id) {
        return litemallGiftCardMapper.selectById(id);
    }

    public void deleteById(Integer id) {
        litemallGiftCardMapper.deleteById(id);
    }

    public void add(LitemallGiftCard giftCard) {
        litemallGiftCardMapper.insert(giftCard);
    }

    public void update(LitemallGiftCard giftCard) {
        litemallGiftCardMapper.updateById(giftCard);
    }

    public List<LitemallGiftCard> selectEnabledList(Integer status){
        return litemallGiftCardMapper.selectList(Wrappers.lambdaQuery(LitemallGiftCard.class)
                .eq(LitemallGiftCard::getStatus,status));
    }


}
